#include <iostream>
#include <iomanip>
#include <string>

#include <map>
using namespace std;

int main()
{

  typedef multimap<string,string> StrStrMultimap;
  StrStrMultimap dict;
  StrStrMultimap::const_iterator iter;

  //insert elements of value_type
  dict.insert(make_pair("day","Tag") );
  dict.insert(make_pair("strange","fremd") );
  dict.insert(make_pair("car","Auto") );
  dict.insert(make_pair("smart","elegant") );
  dict.insert(make_pair("trait","Merkmal") );
  dict.insert(make_pair("strange","seltsam") );
  dict.insert(make_pair("smart","raffiniert") );
  // dict.insert(make_pair("smart","klug") );
  pair<string,string> p("smart","klug");
  dict.insert(p);
  dict.insert(make_pair("clever","raffiniert") );
  //print all elements
  cout.setf(ios::left,ios::adjustfield);
  cout<<setw(10)<<"english"
      <<"german"<<endl;
  cout<<setfill('-')<<setw(20)<<""<<setfill(' ')<<endl;
  for(iter = dict.begin();iter != dict.end();++iter) {
    cout<<setw(10)<<iter->first<<iter->second<<endl;
  }
  cout<<endl;

  //print all values for key "smart"
  string word("smart");
  cout <<word<<":"<<endl;
  for(iter = dict.lower_bound(word);iter != dict.upper_bound(word); ++iter) {
    cout<<setw(4)<<""<<iter->second<<endl;
  }

  //print all key for value "raffiniert"
  word = "raffiniert";
  cout<<word<<":"<<endl;
  for(iter = dict.begin(); iter!= dict.end(); ++iter) {
    if(iter->second == word) {
      cout<<setw(4)<<""<<iter->first<<endl;
    }
  }
  return 0;
}
